<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
// use Illuminate\Support\Facades\Schema;
use Jialeo\LaravelSchemaExtend\Schema;

class CreateActivityCouponMappingsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('activity_coupon_mappings', function (Blueprint $table) {
            $table->id();
            $table->unsignedInteger('couponId')->comment('优惠券id')->default(0);
            $table->unsignedInteger('number')->comment('用户一次领x张某种优惠券')->default(0);
            $table->unsignedInteger('activityId')->comment('活动id')->default(0);
            $table->unsignedInteger('createdAt')->default(0)->comment('创建时间');
            $table->unsignedInteger('updatedAt')->default(0)->comment('更新时间');
            $table->unsignedInteger('createdByUid')->default(0)->comment('创建人');
            $table->unsignedInteger('updatedByUid')->default(0)->comment('更新人');
            $table->tinyInteger("isDeleted")->default(0)->comment("是否删除,0:未删除,1:已删除");
            $table->index("isDeleted", "idx_is_deleted");
            $table->collation = 'utf8mb4_general_ci';
            $table->comment = '活动优惠券映射';
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('activity_coupon_mappings');
    }
}
